// middleware/validateGeoParams.js
const { validateCoordinates } = require('../utils/geoValidator');

module.exports = (req, res, next) => {
  const { lat, lon } = req.query;
  
  if (!validateCoordinates(lat, lon)) {
    return res.status(400).json({
      error: 'Invalid coordinates',
      message: '纬度和经度必须在有效范围内（纬度：-90~90，经度：-180~180）'
    });
  }
  
  next();
};